/*
 * request.cpp
 *
 *  Created on: 2021年8月16日
 *      Author: pengzc
 */

#include <http/http_request.h>

namespace http {

HTTPRequest::HTTPRequest(const std::string& method, const std::string& url) {
  method_ = method;
  url_ = url;
  follow_redirects_ = true;
  max_redirects = 10;
}

HTTPRequest::HTTPRequest(const std::string& method, const std::string& url,
    const std::string& body) {
  method_ = method;
  url_ = url;
  body_ = body;
  follow_redirects_ = true;
  max_redirects = 10;
}

HTTPRequest::HTTPRequest(const std::string& method, const std::string& url,
    const Mime& body): mime_(&body) {
  method_ = method;
  url_ = url;
  follow_redirects_ = true;
  max_redirects = 10;
}

HTTPRequest::~HTTPRequest() {
}

HTTPRequest& HTTPRequest::appendHeader(const std::string& key,
    const std::string& value) {
  header[key] = value;
  return *this;
}

HTTPRequest& HTTPRequest::setContentType(const std::string& content_type) {
  header["Content-Type"] = content_type;
  return *this;
}

void HTTPRequest::setResumeFrom(int offset) {
  resume_from_ = offset;
}

} /* namespace http */


